<?php
require_once('util/txt2array.php');
require_once('util/array2csv.php');

// opening a directory
$dir = "file/";
$dir_handle = opendir($dir);

$headers = ["char","char2"];
// reading the contents of the directory
while(($file_name = readdir($dir_handle)) !== false)
{
    $line = txt2Array($dir . $file_name);
//    todo 筛选和组合

    $data = [$line];
    if(count($data,1)>count($data) ){
        toCSV($file_name,$data,$headers);
        print_r($data);
    }
}

// closing the directory
closedir($dir_handle);


